package com.studentportalen;

import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.TextView;

public class ResultsActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_results);
        
        //Global.setDBHelper(new DBHelper(this));
        //Global.setStudent(870312);
        
        DBHelper db = Global.getDBHelper();
        Cursor c = db.getStudentComplete(Global.getStudent());
        c.moveToFirst();
        
        int n = c.getCount();
        String s = "";  
        
        for (int i=0; i<n; i++){
        	int cid = c.getInt(0);
            String grade = c.getString(1);
            String cname = db.getCourseName(cid);
        	s = s + cname + " " +cid+"\n"+"Grade: "+grade+"\n\n"; 
        	c.moveToNext();
        }
        
        TextView t=new TextView(this); 
        t=(TextView)findViewById(R.id.textView1); 
        t.setTextSize(17);
        t.setText(s);
        
        
    }

}
